<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box {
      /* width: 400px; */
      height: 300px;
      background-color: red;
      transition: all 1s;
    }

    p {
      width: 40px;
      background-color: yellowgreen;
    }

    /* 元素显示前的样式 */
    .fade-enter-from {
      opacity: 0;
      transform: translateX(200px);
    }
    /* 显示的过程中的样式 */
    .fade-enter-active {
      transition: all 1s ease;
    }
    /* 显示后的样式 */
    /* .fade-enter-to {} */
    /* 离开前的样式 */
    /* .fade-leave-from {} */
    /* 离开中的样式 */
    .fade-leave-active {
      transition: all 1s ease;
    }
    /* 离开后的样式 */
    .fade-leave-to {
      opacity: 0;
      transform: translateX(-200px);
    }
  </style>
</head>
<body>
  <div id="app">
    <h1>transtion标签</h1>
    <!-- <div class="box" :style="{width: width + 'px'}"></div> -->

    <transition name="fade">
      <p v-if="show">过渡</p>
    </transition>
    <br>
    <button @click="fn">btn</button>
  </div>

  <script src="../Vue.js"></script>

  <script>
  const { createApp } = Vue
  
  createApp({
    data() {
      return {
        width: 400,
        show: true
      }
    },
    methods: {
      fn() {
        // this.width = 600
        this.show = !this.show
      }
    }
  }).mount('#app')
</script>
</body>
</html>